package io.renren.modules.oss.controller;

import io.renren.common.ueditor.ActionEnter;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
/**
 * 用于处理关于ueditor插件相关的请求
 * @author zzh
 * @date 2018-12-12
 *
 */
@RestController
@RequestMapping("sys/ueditor")
public class UeditorController {

    @RequestMapping(value = "/exec")
    public String exec(HttpServletRequest request) throws UnsupportedEncodingException {
        System.out.println("================action====================="+request.getParameter( "action" ));
        System.out.println("================getContextPath====================="+request.getContextPath());
        System.out.println("================callback====================="+request.getParameter("callback"));
        request.setCharacterEncoding("utf-8");
        String rootPath = request.getSession().getServletContext().getRealPath("/");
        String result = new ActionEnter( request, rootPath ).exec();
        System.out.println("================富文本返回结果====================="+result);
        return result;
    }
}
